import { Actor, Action } from 'iflux2';
import { OrderListType } from '../constant/action-type';

export default class OrderList extends Actor {
    defaultState() {
        return {
            list: [],
            orderMapStatus: {},
            loading: true,
            condition: {
                simpleType: '',
                simpleValue: ''
            }
        }
    }


    @Action(OrderListType.SET_LIST)
    setList(state, { list, orderMapStatus }) {
        return state.set('list', list).set('orderMapStatus', orderMapStatus);
    }


    @Action(OrderListType.SET_LOADING)
    setLoading(state, loading) {
        return state.set('loading', loading);
    }

    @Action(OrderListType.SET_CONDITION)
    setCondition(state, condition) {
        return state.set('condition', condition);
    }
}